$:.unshift File.join(File.dirname(__FILE__),'..','lib')

require 'roadrunner'
require 'httparty'

get163=RoadRunner.new do |session|
  session=
  {:adapter=>"mysql",
  :encoding=>"utf8",
  :database=>"dpmp",
  :username=>"root",
  :password=>"alisoft",
  :host=>"10.2.226.133"}
end
get163.mode = 'thread'

get163.init do
  # users决定同时有多少并发用户一起执行action
  # iterations决定每个用户执行多少次
  get163.users,get163.iterations=10,100
end

get163.action do
  get163.homepage do
    resp = HTTParty.get('http://www.163.com')
#    p resp.headers.inspect
    true
  end
  get163.sports do
    resp = HTTParty.get('http://sports.163.com/')
    true
  end
  true
end

get163.run
get163.report
#get163.save_report(:name=>"Get163HomeAndSports")